package com.tanhua.dubbo.api.impl;

import com.tanhua.domain.mongo.Dimension;
import com.tanhua.dubbo.api.DimensionApi;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

@Service
public class DimensionApiImpl implements DimensionApi {
    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public Dimension findDimensionByUid(Long userId) {
        Query query = new Query(Criteria.where("userid").is(userId));
        return  mongoTemplate.findOne(query, Dimension.class);

    }
}
